//
//  MineViewController.m
//  YouGoWeGo
//
//  Created by LiuFei on 14/11/19.
//  Copyright (c) 2014年 LiuFei. All rights reserved.
//

#import "MineViewController.h"
#import "SetViewController.h"
#import "WantViewController.h"
#import "LikeViewController.h"
#import "SaveViewController.h"
@interface MineViewController ()<UITableViewDataSource, UITableViewDelegate>

@property (readwrite, nonatomic, retain) REMenu *menu;

@end

@implementation MineViewController
- (void)dealloc
{
    [_scroll release];
    [_UserNameLabel release];
    [_setButton release];
    [_UserImage release];
    [_likeButton release];
    [_wantButton release];
    [_saveButton release];
    [_table release];
    [_tableArray release];
    [_alreadyLabel release];
    [super dealloc];
}
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
       
        
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    //[self.view setBackgroundColor:[UIColor orangeColor]];
    self.navigationController.navigationBar.translucent = NO;
    
    
    [self creatValue];
    [self creatSetButton];
    [self creatLikeButton];
    [self creatSaveButton];
    [self creatWantButton];
    [self creatTable];
    
}

# pragma mark -
# pragma 创建页面
- (void)creatValue
{
    self.scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    [_scroll setContentSize:CGSizeMake(self.view.frame.size.width, self.view.frame.size.height * 2)];
   // [scroll setBackgroundColor:[UIColor redColor]];
    [self.view addSubview:_scroll];
    
    
    self.UserNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 50, 30)];
   // [_UserNameLabel setBackgroundColor:[UIColor yellowColor]];
    [self.navigationItem setTitle:_UserNameLabel.text];
    [_UserNameLabel release];
    
    
    self.UserImage = [[UIImageView alloc] initWithFrame:CGRectMake(100, 25 ,150, 100)];
    [_UserImage setImage:[UIImage imageNamed:@"2.png"]];
    
    self.UserImage.layer.masksToBounds = YES;
    self.UserImage.layer.cornerRadius = 50;
    [_UserImage setBackgroundColor:[UIColor yellowColor]];
    
    [_scroll addSubview:_UserImage];
    [_UserImage release];
    [_scroll release];
    

}
#pragma mark -
#pragma UITabelView
- (void)creatTable
{
    self.table = [[UITableView alloc] initWithFrame:CGRectMake(0, 200, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];
    [_table setBackgroundColor:[UIColor grayColor]];
    _table.delegate = self;
    _table.dataSource = self;
    _table.rowHeight = 50;
    [_scroll addSubview:_table];
    [_table release];

}
#pragma mark -
#pragma Cell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIdentify = @"cellIdentify";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentify];
    if (!cell) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIdentify] autorelease];
        
    }
    self.alreadyLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 5, cell.frame.size.width - 20, cell.frame.size.height - 10)];
    [_alreadyLabel setBackgroundColor:[UIColor yellowColor]];
    [cell addSubview:_alreadyLabel];
    
    return cell;

}
#pragma mark -
#pragma row数量
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;//[_tableArray count];
    
}
# pragma mark -
# pragma 设置按钮
- (void)creatSetButton
{
    self.setButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 30)];
    [_setButton setTitle:@"设置" forState:UIControlStateNormal];
    [_setButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithCustomView:_setButton]];
    [_setButton addTarget:self action:@selector(SetbuttonAction:) forControlEvents:UIControlEventTouchUpInside];
    [_setButton release];
    

}
# pragma mark -
# pragma 设置按钮的点击事件
- (void)SetbuttonAction:(id)sender
{
    SetViewController *set = [[SetViewController alloc] init];
    [self.navigationController pushViewController:set animated:YES];
    [set release];
}




# pragma mark -
# pragma 喜欢按钮
- (void)creatLikeButton
{
    self.likeButton = [[UIButton alloc] initWithFrame:CGRectMake(30, 150 , self.view.frame.size.width / 3 - 50, 30)];
    [_likeButton setTitle:@"喜欢" forState:UIControlStateNormal];
    [_likeButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_likeButton addTarget:self action:@selector(likeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    [_likeButton setBackgroundColor:[UIColor yellowColor]];
    [self.scroll addSubview:_likeButton];

}
# pragma mark -
# pragma 喜欢按钮点击事件
- (void)likeButtonAction:(id)sender
{
    LikeViewController *like = [[LikeViewController alloc] init];
    [self.navigationController pushViewController:like animated:YES];
    [like release];
    

}




# pragma mark -
# pragma 收藏按钮
- (void)creatSaveButton
{
    self.saveButton = [[UIButton alloc] initWithFrame:CGRectMake(_likeButton.frame.origin.x + 100, 150, self.view.frame.size.width / 3 - 50, 30)];
    [_saveButton setTitle:@"收藏" forState:UIControlStateNormal];
    [_saveButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_saveButton addTarget:self action:@selector(saveButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    [_saveButton setBackgroundColor:[UIColor yellowColor]];
    [self.scroll addSubview:_saveButton];
    
}
# pragma mark -
# pragma 收藏按钮点击事件
- (void)saveButtonAction:(id)sender
{
    SaveViewController *save = [[SaveViewController alloc] init];
    [self.navigationController pushViewController:save animated:YES];
    [save release];
    
    
}



# pragma mark -
# pragma 想去按钮
- (void)creatWantButton
{
    self.wantButton = [[UIButton alloc] initWithFrame:CGRectMake(_saveButton.frame.origin.x + 100, 150, self.view.frame.size.width / 3 - 50, 30)];
    [_wantButton setTitle:@"想去" forState:UIControlStateNormal];
    [_wantButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_wantButton addTarget:self action:@selector(wantButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    [_wantButton setBackgroundColor:[UIColor yellowColor]];
    [self.scroll addSubview:_wantButton];
    
}
# pragma mark -
# pragma 想去按钮点击事件
- (void)wantButtonAction:(id)sender
{
    WantViewController *want = [[WantViewController alloc] init];
    [self.navigationController pushViewController:want animated:YES];
    [want release];
    
    
}




@end
